package com.syxbyi.hmwk2.phone;

/**
 * （3）上网套餐类 特征：上网流量、每月资费
 * 行为：显示所有套餐信息
 */
public class DataPlan extends Plan implements DataService {
    private double dataTotal;

    public DataPlan(String name, double price, double dataTotal) {
        super.name = name;
        super.price = price;
        this.dataTotal = dataTotal;
    }

    @Override
    public String toString() {
        return String.format("%s\n上网流量：%.2fMB", super.toString(), dataTotal);
    }

    @Override
    public void online(double data, SimCard simCard) {
        System.out.printf("数据流量：%.2f\n%s\n", data, simCard);
    }
}
